package com.zyong.design.pattern.iterator.case1;

/**
 * @program: zyong-design-pattern
 * @ClassName: Client
 * @author: zyong
 * @create: 2024-06-01 08:30
 */
public class Client {
    public static void main(String[] args) {
        StudentAggregate studentAggregate = new StudentAggregateImpl();

        studentAggregate.addStudent(new Student("张三", "1001"));
        studentAggregate.addStudent(new Student("李四", "1002"));
        studentAggregate.addStudent(new Student("王五", "1003"));
        studentAggregate.addStudent(new Student("赵六", "1004"));

        StudentIterator studentIterator = studentAggregate.getStudentIterator();
        while (studentIterator.hasNext()) {
            Student student = studentIterator.next();
            System.out.println(student.toString());
        }
    }
}
